package com.leyou.item.mapper;

import com.leyou.common.mappers.BaseMapper;
import com.leyou.item.entity.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 虎哥
 */
public interface BrandMapper extends BaseMapper<Brand> {

    /**
     * 新增品牌和分类中间表
     * @param ids 很多的分类的id
     * @param bid 品牌的id
     * @return
     */
    int insertCategoryBrand(@Param("ids") List<Long> ids, @Param("bid")Long bid);

    @Select("SELECT b.id, b.name, b.letter, b.image FROM tb_category_brand cb INNER JOIN tb_brand b ON b.id = cb.brand_id WHERE cb.category_id = #{id}")
    List<Brand> queryBrandByCategory(@Param("id") Long id);
}
